package com.zimin.web;

import com.zimin.common.utils.ObjectUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zimin
 * @since 2021/11/12 2:09 下午
 */
public class Test {

    public static void main(String[] args) {
        var a= new SortA("a",10);
        var b= new SortA("b",7);
        var c= new SortA("c",9);
        var d= new SortA("d",8);
        var e= new SortA("e",2);
        var f= new SortA("f",6);
        List<SortA> sortAList= List.of();
        System.out.println("===========排序前=========");
        System.out.println(sortAList);
        System.out.println("===========排序后=========");
        List<SortA> collect = sortAList.parallelStream().sorted(Comparator.comparingInt(SortA::getSort)).collect(Collectors.toList());
        System.out.println(collect);

        var aa = new LinkedList<>();
        System.out.println(ObjectUtils.isEmpty(aa));
    }

    @Data
    private static class  SortA{
        private String a;
        private Integer sort;

        public SortA(String a, Integer sort) {
            this.a = a;
            this.sort = sort;
        }
    }

}
